#Include DrawBase.ahk

class DrawLine extends DrawBase {

  color := '0xff7bfbff', thickness := 5

  UpdateParam(size, color) {
    this.thickness := size, this.color := color
  }

  BeginDraw(pos, *) {
    MouseGetPos(&_x, &_y)
    this.x := _x - pos.x, this.y := _y - pos.y
  }

  EndDraw(*) {
    return [this.x, this.y, this.w, this.h, this.color, this.thickness]
  }

  Draw(overlay, pos, *) {
    super.Draw(overlay, pos)
    overlay.GetMousePos(&x, &y), w := x - this.x, h := y - this.y

    overlay.DrawLine(this.x, this.y, x, y, this.color, this.thickness)
    this.w := x, this.h := y
  }

  static Render(overlay, data, *) {
    overlay.DrawLine(data*)
  }

}